package com.wx_shop.api.controller.api;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wx_shop.api.comm.DValid;
import com.wx_shop.api.service.OrderService;
import com.wx_shop.api.vo.BaseReq;
import com.wx_shop.api.vo.BaseRes;
import com.wx_shop.api.vo.DataPageWrapper;
import com.wx_shop.api.vo.OrderVo;

/**
 * 订单
 * list 
 */
@Controller
@RequestMapping("api/order")
public class OrderRest {
	
	@Resource
	private OrderService orderService;
	
	@ResponseBody
	@RequestMapping(value = "fetchPageOrder", method = RequestMethod.POST)
	public BaseRes<DataPageWrapper<OrderVo>> fetchPageOrder(
			@Validated(value = { DValid.QueryParams.class }) 
			@RequestBody BaseReq<OrderVo> baseReq, 
			BindingResult bindingResult) {
		
		BaseRes<DataPageWrapper<OrderVo>> res = new BaseRes<DataPageWrapper<OrderVo>>();
		
		res = orderService.fetchPageOrder(baseReq);
		
		return res;
	}
	
}
